let uid = location.href.split('?')[1].split('=')[1]
let gametypename = document.querySelector('.gametypename'),
    description = document.querySelector('.description')

const get_one_gametype = async() => {
    let response = await ajax(`get_one_gametype?id=${uid}`)
    let gametype = response.data[0]
    gametypename.value = gametype.typename
    description.value = gametype.description
}

const update_gametype = () => {
    let gametypename1 = gametypename.value,
        description1 = description.value
    let obj = {
        id: uid,
        typename: gametypename1,
        description: description1
    }
    const response = ajax('updategametype', 'PUT', obj)
    alert('修改成功!')
    location.href = './gametype.html'
}
window.onload = function() {
    get_one_gametype()
}